<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// 测试
Route::get('test', 'TestController@index')->name('test.index');
Route::prefix('v1')->group(function () {
    Route::prefix('file')->group(function () {
        Route::get('', 'FileController@index')->name('file.index');
        Route::post('', 'FileController@store')->name('file.store');
        Route::put('/{id}', 'FileController@update')->name('file.update');
        Route::delete('/{id}', 'FileController@destroy')->name('file.destroy');
    });
    Route::prefix('blog')->namespace('Blog')->group(function () {
        // 笔记
        Route::get('doc', 'DocController@index')->name('doc.index');
        Route::get('doc/{id}', 'DocController@view')->name('doc.view');
        // 标签
        Route::get('tag', 'TagController@index')->name('tag.index');
    });
    Route::prefix('note')->namespace('Note')->group(function () {
        // 笔记
        Route::get('doc', 'DocController@index')->name('doc.index');
        Route::get('doc/{id}', 'DocController@view')->name('doc.view');
        Route::post('doc', 'DocController@store')->name('doc.store');
        Route::put('doc/{id}', 'DocController@update')->name('doc.update');
        Route::put('doc/{id}/storage', 'DocController@storage')->name('doc.storage');
        Route::delete('doc/{id}', 'DocController@destroy')->name('doc.destroy');
        // 话题
        Route::get('topic', 'TopicController@index')->name('topic.index');
        Route::get('topic/{id}', 'TopicController@view')->name('topic.view');
        Route::post('topic', 'TopicController@store')->name('topic.store');
        Route::put('topic/{id}', 'TopicController@update')->name('topic.update');
        Route::delete('topic/{id}', 'TopicController@destroy')->name('topic.destroy');

        Route::get('topic_doc/{id}', 'TopicDocController@index')->name('topic_doc.index');
        Route::post('topic_doc', 'TopicDocController@store')->name('topic_doc.store');
        Route::put('topic_doc/{id}', 'TopicDocController@update')->name('topic_doc.update');
        Route::delete('topic_doc/{id}', 'TopicDocController@destroy')->name('topic_doc.destroy');
        // 标签
        Route::get('tag', 'TagController@index')->name('tag.index');
        Route::put('tag', 'TagController@update')->name('tag.update');

        Route::post('query_list', 'QueryListController@query')->name('query_list.query');

        Route::get('query_list_rule', 'QueryListRuleController@index')->name('query_list_rule.index');
        Route::post('query_list_rule', 'QueryListRuleController@store')->name('query_list_rule.store');
        Route::put('query_list_rule/{id}', 'QueryListRuleController@update')->name('query_list_rule.update');
        Route::delete('query_list_rule/{id}', 'QueryListRuleController@destroy')->name('query_list_rule.destroy');
    });
});
